package com.zelix;

import java.io.DataOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Hashtable;

public class cu extends pt
        implements sm {

    private byte o[];
    private boolean p;
    private boolean q;
    private int r[];
    private ArrayList s;
    static final Object t = new Object();

    cu(kt kt1, int i, String s1, jb jb, qy qy1, ty ty1)
            throws IOException {
        super(kt1, i, s1, jb, qy1);
        o = new byte[super.m];
        jb.read(o);
        if (o.length % 2 == 0) {
            String s2;
            int j;
            int k;
            int l;
            s2 = kt1.getClass().getName();
            p = true;
            q = true;
            j = o.length / 2;
            r = new int[j];
            s = new ArrayList(j);
            k = 0;
            for (l = 0; l < j; l++) {
                int i1 = gx.a(o[k++], o[k++]);
                r[l] = i1;
                is is1 = kt1.a(i1);
                if (is1 != null && (is1 instanceof zs)) {
                    s.add(is1);
                    ty1.a(s2, r(), this, is1);
                    qy1.b(is1, this);
                } else {
                    s.add(null);
                    ty1.a(s2, r(), this, t);
                }
            }
        }
    }

    public void a(zs zs1, zs zs2) {
        boolean flag;
        flag = false;
        if (p) {
            for (int i = 0; i < s.size(); i++) {
                if (s.get(i) == zs1) {
                    s.set(i, zs2);
                    flag = true;
                }
            }
        }
        if (!flag)
            super.a(zs1, zs2);
    }

    public void b(int i) {
        s.set(i, null);
    }

    public boolean s() {
        return q;
    }

    public void a(Hashtable hashtable) {
        super.a(hashtable);
        if (p) {
            for (int i = 0; i < s.size(); i++) {
                if (s.get(i) instanceof zs)
                    hashtable.put(s.get(i), this);
            }
        }
    }

    public void a(boolean flag) {
        p = flag;
        if (!p) {
            r = null;
            s = null;
            q = false;
        }
    }

    public void b(boolean flag) {
        q = flag;
    }

    protected void a(DataOutputStream dataoutputstream, Hashtable hashtable, nh nh)
            throws IOException, tb {
        int i;
        super.a(dataoutputstream, hashtable, nh);
        if (p) {
            for (i = 0; i < s.size(); i++) {
                Object obj = s.get(i);
                if (obj == null) {
                    dataoutputstream.writeShort(r[i]);
                } else {
                    is is1 = (is) obj;
                    is is2 = (is) hashtable.get(is1);
                    if (is2 != null) {
                        dataoutputstream.writeShort(is2.j());
                    } else {
                        dataoutputstream.writeShort(is1.j());
                    }
                }
            }
        }
        dataoutputstream.write(o);
    }

}